import request from '@/utils/request'

// 点位 api接口

// 区域列表  区域搜索
export const nodeSearchApi = (params) => {
  return request({
    url: '/vm-service/region/search',
    params
  })
}
// 新添加 区域列
export const addNodeApi = (data) => {
  return request({
    url: '/vm-service/region',
    method: 'POST',
    data
  })
}
// 修改 区域
export const putNodeApi = (data) => {
  return request({
    url: `/vm-service/region/${data.id}`,
    method: 'PUT',
    data: { regionName: data.regionName, // 区域名称
      remark: data.remark // 备注说明
    }
  })
}
// 区域详情
export const infoNodeApi = (id) => {
  return request({
    url: `/vm-service/region/${id}`
  })
}
// 包含点位 点位搜素
export const nodeSiteApi = (params) => {
  return request({
    url: '/vm-service/node/search',
    params
  })
}
// 删除区域
export const delNodeApi = (id) => {
  return request({
    ulr: `/vm-service/region/${id}`,
    method: 'DELETE'
  })
}

// 点位

// 点位搜索
export const nodeSearch = (params = {}, data = {}) => {
  return request({
    url: '/vm-service/node/search',
    params,
    data
  })
}

//  所属商圈   商圈列表
export const fromAddress = () => {
  return request({
    url: '/vm-service/businessType'
  })
}

// 合作商搜索
export const searchPartners = (params) => {
  return request({
    url: '/user-service/partner/search',
    params
  })
}

// 新增点位
export const addNewNode = (data) => {
  return request({
    url: '/vm-service/node',
    method: 'POST',
    data
  })
}
// 点位详情
export const nodeInfoApi = (id) => {
  return request({
    url: `/vm-service/node/vmList/${id}`
  })
}

// 修改点位
export const putNode = (data) => {
  return request({
    url: `/vm-service/node/${data.id}`,
    method: 'PUT',
    data
  })
}

// 合作商

// 合作商搜索
export const partnerSearch = (params) => {
  return request({
    url: '/user-service/partner/search',
    params
  })
}

// 新增合作商
export const addPartner = (data) => {
  return request({
    url: '/user-service/partner',
    method: 'POST',
    data
  })
}
// 修改合作商

export const putPartner = (data) => {
  return request({
    url: `/user-service/partner/${data.id}`,
    method: 'PUT',
    data
  })
}

// 重置合作商 密码
export const resetPartner = (id) => {
  return request({
    url: `/user-service/partner/resetPwd/${id}`,
    method: 'PUT'
  })
}
